﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

using JM.JCY.Common;
using JM.JCY.DataAccess;
using JM.JCY.BusinessEntity;


namespace JM.JCY.BusinessComponent
{
    public class UserManagementBC : JCYBusinessComponentBase<UserManagementDA>
    {
        public UserManagementBC()
            : base(new UserManagementDA())
        {
        }

        public DataSetUserManagement.T_DepartmentDataTable GetAllDepartment()
        {
            return this.DataAccess.GetAllDepartment();
        }

        public bool UpdateDepartmentSortOrder(string deptName, int sortOrder)
        {
            return this.DataAccess.UpdateDepartmentSortOrder(deptName, sortOrder);
        }

        public void UpdateDepartmentSortOrder(DataSetUserManagement.T_DepartmentDataTable dt)
        {
            this.DataAccess.UpdateDepartmentSortOrder(dt);
        }

        public DepartmentTitleDataSet.T_DeptTitleDataTable GetDeptTitleList()
        {
            return this.DataAccess.GetDeptTitleList();
        }



        public int IsExistDept(string DeptName)
        {
            return DataAccess.IsExistDept(DeptName);
        }

        public bool DelDeptById(int deptId)
        {
            return DataAccess.DelDeptById(deptId);

        }

        public DataSetUserManagement.T_JobTitleDataTable GetTitleByDeptId(int deptId)
        {
            return DataAccess.GetTitleByDeptId(deptId);
        }

        public DataSetUserManagement GetDepartmentTitleById(int deptId)
        {
            return DataAccess.GetDepartmentTitleById(deptId);
        }

        public DataSetUserManagement.T_UserInfoDataTable SearchUserInfo(string name, int deptId, int jobTitleId, string status)
        {
            return DataAccess.SearchUserInfo(name, deptId, jobTitleId, status);
        }

        public DepartmentTitleDataSet.T_DeptTitleDataTable GetDeptTitleByUserId(int userId)
        {
            return DataAccess.GetDeptTitleByUserId(userId);
        }


        public void CreateNewDepartment(DataSetUserManagement ds)
        {
            DataAccess.CreateNewDepartment(ds);
        }

        // update by Hong Liang 2011.12.03
        public FrameworkDataset.T_MyCommitteeDataTable GetMyCommittee(string userName)
        {
            return this.DataAccess.GetMyCommittee(userName);
        }

        public DataSetUserManagement.T_DepartmentDataTable GetDeptById(int deptId, string deptName)
        {
            return this.DataAccess.GetDeptById(deptId, deptName);
        }

        public DataSetUserManagement.T_UserInfoDataTable GetUser(int userId, string userName)
        {
            return this.DataAccess.GetUser(userId, userName);
        }

        public DepartmentTitleDataSet.T_DepartmentJobTitleDataTable GetUserDeptTitle(int userId)
        {
            return this.DataAccess.GetUserDeptTitle(userId);
        }

        public void UpdateUserDept(DepartmentTitleDataSet.T_UserDepartmentDataTable dt)
        {
            this.DataAccess.UpdateUserDept(dt);
        }

        public void UpdateUserJobTitle(DepartmentTitleDataSet.T_UserJobTitleDataTable dt)
        {
            this.DataAccess.UpdateUserJobTitle(dt);
        }

        public void UpdateUserInfo(DataSetUserManagement.T_UserInfoDataTable dt)
        {
            this.DataAccess.UpdateUserInfo(dt);
        }

        public DepartmentTitleDataSet.T_UserDepartmentDataTable GetUserDeptByUserId(int userId)
        {
            return this.DataAccess.GetUserDeptByUserId(userId);
        }

        public DepartmentTitleDataSet.T_UserJobTitleDataTable GetUserJobTiTleByUserId(int userId)
        {
            return this.DataAccess.GetUserJobTiTleByUserId(userId);
        }

        public DepartmentTitleDataSet.T_JobTitle_MemberDataTable GetUserJobtitle(int userId, int deptId)
        {
            return this.DataAccess.GetUserJobtitle(userId, deptId);
        }

        public DepartmentTitleDataSet.T_Dept_MemberDataTable GetDepartmentMember(int deptId)
        {
            return this.DataAccess.GetDepartmentMember(deptId);
        }

        public DepartmentTitleDataSet.T_UserInfo_PersonalDataTable GetUserForHome(int userId)
        {
            return this.DataAccess.GetUserForHome(userId);
        }

        public DepartmentTitleDataSet.T_User_Related_DeptDataTable GetUserRelatedDept(string userName)
        {
            return this.DataAccess.GetUserRelatedDept(userName);
        }

        public DepartmentTitleDataSet.T_UserDepartmentDataTable GetUserDeptMatch(int userId, int deptId)
        {
            return this.DataAccess.GetUserDeptMatch(userId, deptId);
        }

        public DepartmentTitleDataSet.T_User_Dept_DataDataTable GetUserDept(int userId)
        {
            return this.DataAccess.GetUserDept(userId);
        }

        // for committee
        public CommitteeDataSet.T_CommitteeDataTable GetCommitteeById(int committeeId)
        {
            return this.DataAccess.GetCommitteeById(committeeId);
        }

        public CommitteeDataSet.T_Committee_MemberDataTable GetCommitteeMember(int committeeId)
        {
            return this.DataAccess.GetCommitteeMember(committeeId);
        }

        public void UpdateCommittee(CommitteeDataSet.T_CommitteeDataTable dt)
        {
            this.DataAccess.UpdateCommittee(dt);
        }

        public void UpdateUserComittee(CommitteeDataSet.T_UserCommitteeDataTable dt)
        {
            this.DataAccess.UpdateUserComittee(dt);
        }

        public CommitteeDataSet.T_UserCommitteeDataTable GetUserCommitteeById(int userCommitteeId)
        {
            return this.DataAccess.GetUserCommitteeById(userCommitteeId);
        }

        public CommitteeDataSet.T_CommitteeDataTable GetCommitteeByName(string committeeName)
        {
            return this.DataAccess.GetCommitteeByName(committeeName);
        }

        public CommitteeDataSet.T_UserCommitteeDataTable GetUserCommitteeMatch(int userId, int committeeId)
        {
            return this.DataAccess.GetUserCommitteeMatch(userId, committeeId);
        }

        public DepartmentTitleDataSet.T_UserDepartmentDataTable GetUserDepartmentByDeptId(int deptId)
        {
            return this.DataAccess.GetUserDepartmentByDeptId(deptId);
        }

        public void UpdateDepartmentMemeberSortOrder(DepartmentTitleDataSet.T_UserDepartmentDataTable dt)
        {
            this.DataAccess.UpdateDepartmentMemeberSortOrder(dt);
        }

        // contact
        public DepartmentTitleDataSet.T_User_ContactDataTable GetUserContactByName(string userName)
        {
            return this.DataAccess.GetUserContactByName(userName);
        }

        public DepartmentTitleDataSet.T_User_ContactDataTable GetUserContactForHome(string userName, int count)
        {
            return this.DataAccess.GetUserContactForHome(userName, count);
        }

        public DataSetUserManagement.T_UserInfoDataTable GetUserForSystem(int userId)
        {
            return this.DataAccess.GetUserForSystem(userId);
        }

        public void CreateDeptMgr(UserInfoDataSet.T_DeptMgrDataTable dt)
        {
            DataAccess.CreateDeptMgr(dt);
        }

        public void DeleteDeptMgrByUserName(string userName)
        {
            DataAccess.DeleteDeptMgrByUserName(userName);
        }

        public UserInfoDataSet.T_DeptMgrDataTable GetUserDeptMgr(string userName)
        {
           return DataAccess.GetUserDeptMgr(userName);
        }

        public void DeleteUserById(int userId)
        {
            DataAccess.DeleteUserById(userId);
        }
    }
}
